package com.tbit.uqbike.client.service.prohibitarea;

import com.tbit.uqbike.client.pojo.Point;
import com.tbit.uqbike.client.pojo.ProhibitArea;
import lombok.Getter;

import java.util.Objects;

/**
 * 禁停区域校验结果
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/28
 */
@Getter
public class CheckProhibitAreaResult {

    /**
     * 禁停区域
     */
    private ProhibitArea prohibitArea;

    /**
     * 校验点与禁停区的距离
     */
    private Double distance;

    /**
     * 校验点
     */
    private Point point;

    public boolean inProhibitArea() {
        return Objects.nonNull(prohibitArea);
    }

    public static CheckProhibitAreaResult success(ProhibitArea prohibitArea, Double distance, Point point) {
        CheckProhibitAreaResult result = new CheckProhibitAreaResult();
        result.prohibitArea = prohibitArea;
        result.distance = distance;
        result.point = point;
        return result;
    }

    public static CheckProhibitAreaResult fail(Point point,Double distance) {
        CheckProhibitAreaResult result = new CheckProhibitAreaResult();
        result.point = point;
        result.distance = distance;
        return result;
    }

}
